﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LogicProgram;
using WeaponLibrary;
namespace ProgramInterface
{
    public class Interface
    {
        static void Main()
        { }
        public void Menu()
        {
            int flag = 0;
            ProductCalculation _calc = new ProductCalculation();
            ProductPrinter _print = new ProductPrinter();
            ProductFactory _fact = new ProductFactory();
            FileLogger _flogger=new FileLogger();
            ConsoleLogger _clogger = new ConsoleLogger();
            var _weapon = new List<Weapon>();
            while (flag != 4)
            {
                Console.WriteLine("1. Buy new weapon");
                Console.WriteLine("2. Total price");
                Console.WriteLine("3. Look weapon");
                Console.WriteLine("4. Exit");
                _clogger.WriteLog();
                flag = Convert.ToInt32(Console.ReadLine());
                
                switch (flag)
                {
                    case 1:
                        {
                            Console.Clear();
                            Console.WriteLine("1. Buy Gun");
                            Console.WriteLine("2. Buy Dagger");
                            switch (Convert.ToInt64(Console.ReadLine()))
                            {
                                case 1: _weapon.Add(_fact.CreateGun()); _flogger.Log("Gun was bought"); _clogger.Log("Gun was bought"); break;
                                case 2: _weapon.Add(_fact.CreateDagger()); _flogger.Log("Dagger was bought"); _clogger.Log("Dagger was bought"); break;
                            }
                            break;
                        }
                    case 2: { Console.Clear(); Console.WriteLine("Total Price"); Console.WriteLine(_calc.GetTotalPrice(_weapon, _weapon.Count)); _flogger.Log("Total price was written"); _clogger.Log("Total price was written"); break; }
                    case 3: { Console.Clear(); Console.WriteLine("Write number weapon"); int number =( Convert.ToInt32(Console.ReadLine())-1); _print.Print(_weapon, _weapon[number].Name,number); _flogger.Log("Information about weapon №" + (number+1) + " was wtitten"); _clogger.Log("Information about weapon №" + (number+1) + " was wtitten"); break; }
                    case 4: { _flogger.Log("Work was completed"); _clogger.Log("Work was completed"); break; }
                }
                
            }
        }
    }
}
